﻿using System;
using System.Activities;
using System.Collections.Generic;
using KPIS.GERP.SERVICE.Model;
using System.Linq;

namespace KPIS.GERP.SERVICE.WorkflowService.CodeActivity
{
    public sealed class Get_EmpTypeSeq : CodeActivity<int?>
    {
        public InArgument<string> in_emp_seq { get; set; }
        public InArgument<string> in_emp_type_seq { get; set; }
        public InArgument<string> in_class_seq { get; set; }
        public InArgument<string> in_pos_seq { get; set; }
        public InArgument<string> in_working_job_site_seq { get; set; }
        public InArgument<string> in_exec_pos_seq { get; set; }
        public InArgument<string> in_emp_status_seq { get; set; }
        public InArgument<string> in_active { get; set; }

        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasNamePrefixes { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasGenders { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasReligions { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasNationalitiesRace { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasNationalities { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmPsEmployeeTypes { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpClasses { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpClassesOld { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpPositions { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpJobSites { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmPsEmployeeStatuses { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasBloodGroups { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpExecPositions { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasMaritalStatuses { get; set; }

        protected override int? Execute(CodeActivityContext context)
        {
            List<hrm_ps_employees> list = new DAL.Employee().GetHrmPsEmployee(
                in_emp_seq.Get(context)
                , in_emp_type_seq.Get(context)
                , in_class_seq.Get(context)
                , in_pos_seq.Get(context)
                , in_working_job_site_seq.Get(context)
                , in_exec_pos_seq.Get(context)
                , in_emp_status_seq.Get(context)
                , in_active.Get(context)
                , in_IsGetMasNamePrefixes.Get(context)
                , in_IsGetMasGenders.Get(context)
                , in_IsGetMasReligions.Get(context)
                , in_IsGetMasNationalitiesRace.Get(context)
                , in_IsGetMasNationalities.Get(context)
                , in_IsGetHrmPsEmployeeTypes.Get(context)
                , in_IsGetHrmMpClasses.Get(context)
                , in_IsGetHrmMpClassesOld.Get(context)
                , in_IsGetHrmMpPositions.Get(context)
                , in_IsGetHrmMpJobSites.Get(context)
                , in_IsGetHrmPsEmployeeStatuses.Get(context)
                , in_IsGetMasBloodGroups.Get(context)
                , in_IsGetHrmMpExecPositions.Get(context)
                , in_IsGetMasMaritalStatuses.Get(context));
            if (list.Count > 0)
                return list.SingleOrDefault().emp_type_seq;
            else
                return null;
        }
    }

    public sealed class Select_HrmPsEmployee : CodeActivity<List<hrm_ps_employees>>
    {
        public InArgument<string> in_emp_seq { get; set; }
        public InArgument<string> in_emp_type_seq { get; set; }
        public InArgument<string> in_class_seq { get; set; }
        public InArgument<string> in_pos_seq { get; set; }
        public InArgument<string> in_working_job_site_seq { get; set; }
        public InArgument<string> in_exec_pos_seq { get; set; }
        public InArgument<string> in_emp_status_seq { get; set; }
        public InArgument<string> in_active { get; set; }

        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasNamePrefixes { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasGenders { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasReligions { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasNationalitiesRace { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasNationalities { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmPsEmployeeTypes { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpClasses { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpClassesOld { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpPositions { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpJobSites { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmPsEmployeeStatuses { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasBloodGroups { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetHrmMpExecPositions { get; set; }
        /// <summary>
        /// set True for join this object
        /// </summary>
        public InArgument<bool> in_IsGetMasMaritalStatuses { get; set; }

        protected override List<hrm_ps_employees> Execute(CodeActivityContext context)
        {
            List<hrm_ps_employees> list = new DAL.Employee().GetHrmPsEmployee(
                in_emp_seq.Get(context)
                , in_emp_type_seq.Get(context)
                , in_class_seq.Get(context)
                , in_pos_seq.Get(context)
                , in_working_job_site_seq.Get(context)
                , in_exec_pos_seq.Get(context)
                , in_emp_status_seq.Get(context)
                , in_active.Get(context)
                , in_IsGetMasNamePrefixes.Get(context)
                , in_IsGetMasGenders.Get(context)
                , in_IsGetMasReligions.Get(context)
                , in_IsGetMasNationalitiesRace.Get(context)
                , in_IsGetMasNationalities.Get(context)
                , in_IsGetHrmPsEmployeeTypes.Get(context)
                , in_IsGetHrmMpClasses.Get(context)
                , in_IsGetHrmMpClassesOld.Get(context)
                , in_IsGetHrmMpPositions.Get(context)
                , in_IsGetHrmMpJobSites.Get(context)
                , in_IsGetHrmPsEmployeeStatuses.Get(context)
                , in_IsGetMasBloodGroups.Get(context)
                , in_IsGetHrmMpExecPositions.Get(context)
                , in_IsGetMasMaritalStatuses.Get(context));         
                return list;
        }
    }
}
